// run: $exec < input
#include <iostream>
#include <functional>
#include <algorithm>
#include <string>
#include <map>

long long const mo = 1000000007;
int const maxn = 100006;
long long fact[maxn];
long long invf[maxn];

std::map<char, long long> id{ {'A', 0}, {'C', 1}, {'G', 2}, {'T', 3}, };
long long count[5];
long long n;
std::string s;

void extended_gcd(long long a, long long b, long long & d, long long & x, long long & y)
{
	if (!b) { d = a; x = 1; y = 0; }
	else {
		extended_gcd(b, a % b, d, y, x);
		y -= x * (a/b);
	}
}

long long inverse(long long t, long long p)
{
	long long x, y, d;
	extended_gcd(t, p, d, x, y);
	return (x % p + p) % p;
}

void init()
{
	fact[0] = invf[0] = 1;
	for (int i = 1; i < maxn; i++) fact[i] = (fact[i - 1] * i) % mo;
	for (int i = 1; i < maxn; i++) invf[i] = inverse(fact[i], mo);
}

long long combine(int n, int m)
{
	if (!m || n == 1) return 1;
	long long ret = fact[n];
	ret = (ret * invf[n - m]) % mo;
	return (ret * invf[m]) % mo;
}

int main()
{
	std::ios::sync_with_stdio(false);
	init();
	std::cin >> n;
	std::cin >> s;
	for (auto c : s) count[id[c]]++;
	std::sort(count, count + 4, std::greater<int>());

	long long ans = 1;
	if (count[0] == count[1] && count[0] == count[2] && count[0] == count[3]) {
		for (int i = 0; i < n; i++) ans = (ans * 4) % mo;
	} else if (count[0] == count[1] && count[0] == count[2]) {
		for (int i = 0; i < n; i++)
			ans = (ans * 3) % mo;
	} else if (count[0] == count[1]) {
		for (int i = 0; i < n; i++)
			ans = (ans * 2) % mo;
	}
	std::cout << ans << '\n';
}

